# ffmpeg
# Builds from https://github.com/puppylinux-woof-CE/petbuilds
# File auto generated by ./mk_petbuild.sh. Edit as necessary.

. ../func
. ../build.conf

URL=https://ffmpeg.org/releases
PKG=ffmpeg
VER=2.8.11
COMP=tar.xz
DESC="ffmpeg"
DEPS=+sdl,+x264,+x265,+speex,+libogg,+libvorbis,+fdk-aac,+libvpx,+libtheora,+lame
CAT=BuildingBlock
DESKTOP=ffmpeg.desktop
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
# comment these 2 below if you use a custom package() function
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not

ARCH=$(uname -m)
case $ARCH in # set in build.conf
 *64) 	LIBDIR=$LIBCONF64 
		FLAGS=$CF64;;
 arm*)	LIBDIR=$LIBCONFarm
		FLAGS="-O2" ;;
 i686) 	LIBDIR=$LIBCONF32 
		FLAGS=$CF32;;
	*) 	LIBDIR=$LIBCONF32 
		FLAGS="-O2 -march=$ARCH -mtune=$ARCH";;
esac

build() {
	cd ${PKG}-${VER}
	./configure --prefix=/usr \
				--libdir=/usr/${LIBDIR} \
				--enable-libmp3lame \
				--enable-libx264 \
				--enable-libx265 \
				--enable-libfdk-aac \
				--enable-pthreads \
				--enable-small \
				--enable-postproc \
				--enable-libvorbis \
				--enable-gpl \
				--enable-shared \
				--enable-nonfree \
				--enable-libopencore-amrnb \
				--enable-libopencore-amrwb \
				--disable-debug \
				--enable-bzlib \
				--enable-zlib \
				--enable-libspeex \
				--enable-version3 \
				--enable-runtime-cpudetect \
				--enable-x11grab \
				--enable-libtheora \
				--enable-libxvid  \
				--enable-swscale \
				--enable-libvpx
	[ "$?" -eq 0 ] || exit
	make $MKFLG
	[ "$?" -eq 0 ] || exit
	make DESTDIR=$CWD/${PKG}-install install
	cd -
}
	
# main
retrieve ${PKG}-${VER}.${COMP}
extract ${PKG}-${VER}.${COMP}
build
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
